package castledefense.gui;

import castledefense.logic.buildings.Castle;
import twl.global.widget.LabelFonts;
import de.matthiasmann.twl.GUI;
import de.matthiasmann.twl.Widget;

public class LevelPanel extends Widget{
	
	private GUIMainGame stateGui;
	
	private LabelFonts levelLabel;
	private LabelFonts levelTimeLabel;
	private LabelFonts castleHealthLabel;
	
	public LevelPanel(GUIMainGame gui){
		stateGui = gui;
		
		setTheme("panelTheme");
		
		levelLabel = new LabelFonts();
		levelLabel.setTheme("labelTheme");
		levelLabel.setFont("arialBold16");
		levelLabel.setPosition(15,20);
		add(levelLabel);
		
		levelTimeLabel = new LabelFonts();
		levelTimeLabel.setTheme("labelTheme");
		levelTimeLabel.setFont("arialBold16");
		levelTimeLabel.setPosition(86, 20);
		add(levelTimeLabel);
		
		castleHealthLabel = new LabelFonts();
		castleHealthLabel.setTheme("labelTheme");
		castleHealthLabel.setFont("arialBold16");
		castleHealthLabel.setPosition(218, 20);
		add(castleHealthLabel);
		
	}
	
	@Override
	protected void paint(GUI gui){
		levelLabel.setText("Level : " + stateGui.getState().getLevel());
		levelTimeLabel.setText("--  Next level in : " + (stateGui.getState().getLevelTime()/1000 + 1));
		Castle castle = stateGui.getState().getMap().getCastle();
		castleHealthLabel.setText("--  " + (int)castle.getLife() + " / " + castle.getInitialLife());
		super.paint(gui);
	}

}
